<template>
  <div class="wscn-http404-container">
    <div class="wscn-http404">
      <div class="pic-404">
        <img class="pic-404__parent" src="../../assets/error/wrong.png" alt="404">
      </div>
      <div class="bullshit">
        <div class="bullshit__oops">
          抱歉!
        </div>
        <!-- <div class="bullshit__info">
                版权所有
                <a class="link-type" target="_blank">中世科技</a>
            </div> -->
        <!-- <div class="bullshit__headline">
                {{ message }}
            </div> -->
        <div v-if="!$route.query.msg" class="bullshit__info">
          <!-- 请检查您输入的网址是否正确，请点击以下按钮返回主页 -->
          {{ message }}
        </div>
        <div>
          <el-button class="bullshit__return-home bullshit__return-login" @click="logoutApi">
            去登录
          </el-button>
          <el-button class="bullshit__return-home" @click="handleBack">
            返回
          </el-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { removeToken } from '@/utils/auth'

export default {
  name: 'Page404',
  computed: {
    message() {
      let msg = '这个页面啥也没有。。。'
      if (this.$route.query.msg) {
        msg = '你无权访问该页面！'
      }
      return msg
    },
    homeMenu() {
      const menus = this.$store.getters.menus
      console.log('打印==', menus[0])
      return this.$route.query.msg ? 'Login' : menus[0] || 'Login'
    }

  },
  methods: {
    logoutApi() {
      this.$store.dispatch('LogOut').then(() => {
        removeToken()
        this.$store.commit('SET_DICTIONARY_LIST', {})
        this.$router.replace({ name: 'Login' })
      })
    },
    handleBack() {
      this.$router.go(-1)
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
@import './error.scss';
.app-main {
    height: 100vh !important;
}
</style>
